<?php

class Create extends Controller {

	function Create() {
		parent::Controller();
		
		// loading model, assigning alias, forcing DB connect
		$this->load->model('Tagging_model', 'Tagging', TRUE);
		$this->load->model('Feeding_model', 'Feeding', TRUE);
		
		// helpers
		$this->load->helper('url');
		$this->load->helper('form');
	}
	
	function index() {
		
	}
	
	/*
		BASIC TAG FUNCTIONS
	*/
	function root_tag() {
		$data['title'] = "Set Root Tag";
		$data['heading'] = "Create a New Root Tag";

		$this->load->view('create/root_tag_form', $data);
	}
	
	function root_tag_insert() {
		$root_tag_parent_id = $_POST['root_tag_parent_id'];
		$tag = $_POST['tag'];
		
		// TO DO:: SANITIZE INPUTS !!
		
		$this->Tagging->add_root_tag($root_tag_parent_id, $tag);
		
		redirect('view/root_tags');
	}
}
?>